﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace ihm
{
    public partial class FenetreDemandeExpedition : Form
    {
        
        CIAI fenetrePrincipale;

        public FenetreDemandeExpedition(CIAI c)
        {
            fenetrePrincipale = c;
            InitializeComponent();
        }

        private void buttonAnnuler_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        //Validation de l'expédition, envoi du message et rajout dans l'IHM
        private void buttonValider_Click(object sender, EventArgs e)
        {
            Expedition exp = new Expedition((int)numericUpDown1.Value, (int)numericUpDown2.Value);
            fenetrePrincipale.Sender.SendMessage(new Message(Message.TypeObjet.Commande, Message.TypeMessage.Information, exp.Id, ((int)numericUpDown1.Value).ToString() +" "+((int)numericUpDown2.Value).ToString()));
            fenetrePrincipale.ajoutExpedition(exp.Id, ((int)numericUpDown1.Value).ToString(), ((int)numericUpDown2.Value).ToString());
            fenetrePrincipale.ajouterExpedition(exp);
            this.Close();
        }
    }
}